home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr05 / ew120.zip / FILES1.ZIP / SELWORD.C < prev    next >
C/C++ Source or Header  |  1993-05-02  |  2KB  |  49 lines

  1. /*------------------------------------------------
  2.    SELWORD.C -- Extension DLL for E! - version 1.1
  3.  
  4.    To compile: nmake selword.mak
  5.  
  6.    Once compiled, copy SELWORD.EWD to your USER directory.
  7.  
  8.    To use this DLL simply load it from the user menu or add its name to the
  9.    list of autoloaded Extension DLLs using the Autoload dialog box from
  10.    the User Menu of EW. That's all.
  11.  
  12.    This Extension DLL uses no hook. It merely uses some API functions to
  13.    select the word at the cursor position.
  14.  
  15.    You can assign this extension to a keystroke. See the documentation for
  16.    a description of how to assign DLL execution to a keystroke.
  17.   ------------------------------------------------*/
  18.  
  19. #include <windows.h>
  20. #include "ewapi.h"
  21.  
  22. int FAR PASCAL LibMain (HANDLE hInstance, WORD wDataSeg, WORD wHeapSize,
  23.                         LPSTR lpszCmdLine)
  24. {
  25.   if (wHeapSize > 0)
  26.     UnlockData (0) ;
  27.   return 1 ;
  28. }
  29.  
  30. int FAR PASCAL EWExecute(unsigned int RoutineId)
  31. {
  32.   long WordBoundaries;
  33.   int  CurrentLine;
  34.  
  35.   /* Get the first and last character of the current word */
  36.   WordBoundaries = EWGetCurWord();
  37.   if (WordBoundaries != -1L) {
  38.     /* Get the current line */
  39.     CurrentLine = HIWORD(EWGetCaretPos());
  40.     /* Select the word */
  41.     EWBeginSelection(EWSelection_Block, (int) LOWORD(WordBoundaries), CurrentLine);
  42.     EWUpdateSelection((int) HIWORD(WordBoundaries), CurrentLine);
  43.     EWStopSelection((int) HIWORD(WordBoundaries), CurrentLine);
  44.     return(0);
  45.   }
  46.   else
  47.     return(ewerr_EXTFAILED);
  48. }
  49.